<template>
  <div >
    <a-form-model class="fromModels" ref="newSifangModel"  :model="newSifangFroms" layout="vertical" 
    :labelCol="{span: 6}" :wrapperCol="{span: 12}">
        <a-form-model-item label="平台" >
          <a-select v-model="platform">
            <a-select-option v-for="(item,index) in selects" :key="index" :value="item.id">{{ item.name }}</a-select-option>
          </a-select>
        </a-form-model-item>
        <a-form-model-item label="appid">
          <a-input v-model="newSifangFroms.appid"  placeholder="请输入appid" />
        </a-form-model-item>
        <a-form-model-item label="appSecret">
          <a-input v-model="newSifangFroms.appSecret"  placeholder="请输入appSecret" />
        </a-form-model-item>
        <a-form-model-item  :wrapper-col="{ span: 12, offset:5 }">
          <a-button type="primary" @click="whites">提交</a-button>
        </a-form-model-item>
    </a-form-model>
  </div>
</template>

<script>
import {getConfigCommon,writeConfigCommon } from '@/api/system.js'
export default {
  name: 'newSifang',
  
  data() {
      return {
        platform:"xsf",
        selects:[
          {id:'xsf',name:"新四方"},
        ],
        newSifangFroms:{
          appSecret:"",
          appid:"",
        },
      }
  },
  created(){
    this.getPrivacyAgreementInfo()
  },
  methods:{
    getPrivacyAgreementInfo(){
      getConfigCommon({
        scene:'channel',
        brand_id: process.env.VUE_APP_BRAND_ID,
        platform:this.platform
      }).then(res=>{
        this.newSifangFroms=res.data
      })
    },
    whites(){
      writeConfigCommon({
        scene:'channel',
        brand_id: process.env.VUE_APP_BRAND_ID,
        platform:this.platform,
        ...this.newSifangFroms
      }).then(res=>{
        this.$message.success("操作成功");
      })
    },
  }
}
</script>

<style lang="less" scoped>
</style>
